﻿

@inject Eqwww.App.Identity.UserApp UserApp
@inject Eqwww.Config.IAppConfigProvider AppConfigProvider
@{
    var appConfig = AppConfigProvider.Load();

    var userModel = UserApp.GetUserAsync(User).Result;

}

@{
    Layout = null;

    var appBarCss = "mdui-color-theme";
    if (appConfig.WhiteAppbar)
    {
        appBarCss = "mdui-color-white";
    }
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@appConfig.AppName @appConfig.AppVersion</title>
    <link rel="icon" type="image/png" href="~/images/logo1.png">
    <link rel="icon" sizes="192x192" href="~/images/logo1.png">
    <link rel="stylesheet" type="text/css" href="~/lib/mdui/css/mdui.min.css" />
    <link rel="stylesheet" type="text/css" href="~/css/manage.css" asp-append-version="true" />
    <style type="text/css">
        .eq-lineloading .mdui-progress-indeterminate {
        }
    </style>
</head>
<body class="mdui-theme-primary-@appConfig.DefaultThemeColor mdui-theme-accent-@appConfig.DefaultAccentColor  mdui-appbar-with-toolbar mdui-drawer-body-left">
    <div class="eq-lineloading" style="position:fixed;width:100%;bottom:0;left:0;z-index:99990000;display:none;">
        <div class="mdui-progress">
            <div class="mdui-progress-indeterminate">
            </div>
        </div>
    </div>


    <header id="eq-header" class="mdui-appbar mdui-appbar-fixed mdui-shadow-1 @appBarCss">
        <div class="mdui-toolbar">
            <span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-drawer="{target: '#main-drawer', swipe: true}"><i class="mdui-icon material-icons">menu</i></span>
            <a class=" mdui-valign" href="~/">
                <img src="~/images/logo.png" style="height:40px;" />
            </a>
            
            <a href="javascript:;" id="eq-appbar-typo-title" class="mdui-typo-title"></a>

            <div class="mdui-toolbar-spacer"></div>


            <a id="btn-mail" href="javascript:;" class="mdui-ripple mdui-btn mdui-btn-icon">
                <i class="mdui-icon material-icons">mail_outline</i>
            </a>


            <a href="javascript:;" class="mdui-ripple mdui-p-l-1 mdui-p-r-1 mdui-clearfix mdui-valign" mdui-menu='{ target: "#eqManageUserAction",covered:false }'>
                <img src="@UserApp.GetAvatar(userModel)" class="mdui-img-circle mdui-img-fluid mdui-float-left" style="width:36px;" />
                <span class="mdui-float-right mdui-m-l-1 mdui-hidden-sm-down">
                    @if (appConfig.RealNameFirst)
                    {
                        @(userModel.RealName ?? userModel.UserName)
                    }
                    else
                    {
                        @userModel.UserName
                    }
                </span>
                <i class="mdui-icon material-icons">keyboard_arrow_down</i>
            </a>

            <ul class="mdui-menu" id="eqManageUserAction">
                <li class="mdui-menu-item">
                    <div class="mdui-text-center">
                        <img src="@UserApp.GetAvatar(userModel)" class="mdui-img-circle" style="width:128px;" />
                    </div>
                </li>
                <li class="mdui-menu-item">
                    <a href="javascript:;" class="mdui-ripple mdui-text-center">
                        @userModel.UserName
                    </a>
                </li>
                <li class="mdui-menu-item">
                    <a href="javascript:;" onclick="btn_myaccount()" class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">remove_red_eye</i>我的账号
                    </a>
                </li>
                <li class="mdui-menu-item">
                    <a href="javascript:;" onclick="btn_logout()" class="mdui-ripple">
                        <i class="mdui-menu-item-icon mdui-icon material-icons">arrow_forward</i>退出登录
                    </a>
                    @Html.AntiForgeryToken()
                </li>
            </ul>

        </div>

    </header>

    <div class="mdui-drawer @if (appConfig.DarkDrawer) { <text>mdui-color-blue-grey-800</text>} mdui-shadow-3" id="main-drawer">
        <div id="eq-main-drawer-list" class="mdui-list" mdui-collapse="{accordion: true}" style="margin-bottom: 76px;">
            <div class="mdui-text-center">
                <div class="mdui-spinner mdui-spinner-colorful"></div>
                <div>加载菜单...</div>
            </div>
        </div>
    </div>


    <div>
        <div class="mdui-clearfix @if (appConfig.DarkDrawer) { <text>mdui-color-blue-grey-800</text>} ">
            <div id="eq-manage-tab" class="mdui-tab @if (appConfig.DarkDrawer) { <text>mdui-color-blue-grey-800</text>} mdui-hidden-sm-down" mdui-tab>
                <a id="eq-dashboard" href="#example1-tab1" class="mdui-ripple">
                    <div>
                        控制面板
                    </div>
                </a>
            </div>
        </div>


        <div id="eq-manage-tabcontent">
            <div id="example1-tab1">
                <iframe frameborder="0" src="/Manage/Default" style="width:100%;"></iframe>
            </div>

        </div>



    </div>

    <div id="loadingBox">
        <div class="mdui-card mdui-color-grey-800">
            <div class="mdui-card-content mdui-valign">
                <div class="mdui-spinner mdui-spinner-colorful"></div>
                <div id="loadingContent" class="mdui-m-l-2">加载中,请稍候...</div>
            </div>
        </div>
    </div>



    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/jquery-cookie/jquery.cookie.js"></script>
    <script src="~/lib/mdui/js/mdui.min.js"></script>
    <script src="~/lib/layer/layer.js"></script>
    <script src="~/js/layerconfig.js" asp-append-version="true"></script>
    <script src="~/lib/signalr/signalr.min.js"></script>

    <script src="~/js/manage/manage.js" asp-append-version="true"></script>
    <script src="~/js/manage/modal.js" asp-append-version="true"></script>
    <script src="~/js/manage/loadmenu.js" asp-append-version="true"></script>

    <script src="~/js/hub.js" asp-append-version="true"></script>

    <script>
        $(function () {
            handlerIframeHeight();

        });

        function btn_myaccount() {
            $.modalOpen({
                id: 'MyAccount',
                title: '我的账号',
                url: '/SystemManage/MyAccount',
                width: '100%',
                height: '100%',
                isback: true,
                hideConfirmBtn: true,
                btn: null
            });
        }

        function btn_logout() {
            var postdata = {};
            if ($('[name=__RequestVerificationToken]').length > 0) {
                postdata["__RequestVerificationToken"] = $('[name=__RequestVerificationToken]').val();
            }

            $.loadingBox(false);

            $.ajax({
                url: '/Identity/Account/Logout',
                type: 'post',
                data: postdata,
                dataType: 'json',
                success: function (data) {
                    if (data.state == 'success') {
                        $.snackbar('<i class="mdui-icon material-icons mdui-text-color-green">check</i>' + data.message, data.state);
                        window.location.href = "/";
                    }
                    else {
                        $.loadingBox(true);
                        $.modalAlert(data.message, 'error');
                    }
                }
            })
        }
    </script>
</body>
</html>
